package com.norteksoft.erm.model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.norteksoft.erm.resource.DataResource;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * @hibernate.class table="ERM_WEBMODULE"
 */

public class WebModule extends BaseObject {

	private static final long serialVersionUID = -9084752257307094211L;

	private Long webModuleID = new Long(-1);// OID

	private String webModuleName;// 子系统中文名

	private String code;// 子系统编号，通常就是context，如：erm、qim……

	private List users;// 子系统管理员

	private String memo;// 子系统注释

	private String contextURL;// 系统的访问地址，如：http://www.jiffy.com:8088/erm

	private List resources = new ArrayList();// 子系统的功能资源集（降级使用）

	private Set myDataResources = new HashSet();// 子系统的数据资源集
	
	private String isNav; //是否在导航显示
	
	private Integer displayOrder;// 显示排序

	// ~~ 遗留或未知属性 ====================================
	private String className;

	private DataResource dataResource;

	private String beanName;

	private String facePage;

	private String configPath;

	private String state;

	public int hashCode() {
		return new HashCodeBuilder().append(webModuleID).append(webModuleName)
				.append(code).append(memo).append(contextURL).append(className)
				.append(beanName).append(facePage).append(configPath).append(
						state).toHashCode();
	}

	public WebModule() {
	}

	/**
	 * @hibernate.id generator-class="sequence" column="WEBMODULEID"
	 *               unsaved-value="-1" type="long"
	 * @hibernate.generator-param name="sequence" value="ERM_SEQUENCE"
	 */
	public Long getWebModuleID() {
		return webModuleID;
	}

	public void setWebModuleID(Long webModuleID) {
		this.webModuleID = webModuleID;
	}

	/**
	 * @hibernate.property column="WEBMODULENAME" length="255" type="string"
	 *                     not-null="true"
	 * @return String
	 */
	public String getWebModuleName() {
		return webModuleName;
	}

	public void setWebModuleName(String webModuleName) {
		this.webModuleName = webModuleName;
	}

	/**
	 * @hibernate.property column="CLASSNAME" length="255" type="string"
	 * @return String
	 */
	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	/**
	 * @hibernate.property column="DATARESOURCE" length="255" type="string"
	 * @return String
	 */
	public DataResource getDataResource() {
		return dataResource;
	}

	public void setDataResource(DataResource dataResource) {
		this.dataResource = dataResource;
	}

	/**
	 * @hibernate.property column="CONFIGPATH" length="255" type="string"
	 * @return String
	 */
	public String getConfigPath() {
		return configPath;
	}

	public void setConfigPath(String configPath) {
		this.configPath = configPath;
	}

	/**
	 * @hibernate.property column="BEANNAME" length="255" type="string"
	 * @return String
	 */
	public String getBeanName() {
		return beanName;
	}

	public void setBeanName(String beanName) {
		this.beanName = beanName;
	}

	/**
	 * @hibernate.property column="FACEPAGE" length="255" type="string"
	 * @return String
	 */
	public String getFacePage() {
		return facePage;
	}

	public void setFacePage(String facePage) {
		this.facePage = facePage;
	}

	/**
	 * @hibernate.property column="STATE" length="255" type="string"
	 * @return String
	 */
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	/**
	 * @hibernate.bag name="resources" cascade="all-delete-orphan" lazy="true"
	 *                inverse="true" order-by="displayOrder asc,resourceID asc"
	 * @hibernate.key column="WEBMODULEID"
	 * @hibernate.one-to-many class="com.norteksoft.erm.model.Resource" 
	 * @return List
	 */
	public List getResources() {
		return resources;
	}

	public void setResources(List resources) {
		this.resources = resources;
	}

	/**
	 * @hibernate.bag name="users" table="ERM_USER_WEBMODULE" cascade="none"
	 *                lazy="true" inverse="true" outer-join="auto"
	 * @hibernate.key column="WEBMODULEID"
	 * @hibernate.many-to-many class="com.norteksoft.erm.model.User"
	 *                         column="USERID"
	 * @return List
	 */
	public List getUsers() {
		return users;
	}

	public void setUsers(List users) {
		this.users = users;
	}


	/**
	 * @hibernate.property column="CODE" length="30" type="string"
	 *                     not-null="true"
	 * @return String
	 */

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * @hibernate.property column="MEMO" length="2000" type="string"
	 * @return String
	 */

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	/**
	 * @hibernate.property column="CONTEXTURL" length="255" type="string"
	 * @return String
	 */
	public String getContextURL() {
		return contextURL;
	}

	public void setContextURL(String contextURL) {
		this.contextURL = contextURL;
	}

	/**
	 * @hibernate.set lazy="true" inverse="true" cascade="all-delete-orphan"
	 *                order-by="NAME asc"
	 * @hibernate.key column="WEBMODULEID"
	 * @hibernate.one-to-many class="com.norteksoft.erm.model.DataResource"
	 * @return Set
	 */
	public Set getMyDataResources() {
		return myDataResources;
	}

	public void setMyDataResources(Set myDataResources) {
		this.myDataResources = myDataResources;
	}

	/**
	 * @hibernate.property column="ISNAV" length="50" type="string"
	 * @return String
	 */
	public String getIsNav() {
		return isNav;
	}
	
	/**
	 * @hibernate.property column="DISPLAYORDER" type="integer"
	 * @return Integer
	 */
	public Integer getDisplayOrder() {
		return displayOrder;
	}

	public void setIsNav(String isNav) {
		this.isNav = isNav;
	}

	public void setDisplayOrder(Integer displayOrder) {
		this.displayOrder = displayOrder;
	}
}
